package com.xyzh05.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableId;
import org.compass.annotations.SearchableProperty;

@Entity
@Table(name="school_info")
@Searchable
@XmlRootElement
public class SchoolInfo extends BaseObject implements Serializable {
	private static final long serialVersionUID = 5365511491655561717L;
	
	private Long id;
    private School school;
    private String toefl;
    private String gre;
    private String sat;
    private String ps;
    private String cv;
    private String rl;
    private String essay;
    private String applyUrl;
    private String applyCost;
    private String sendAddress;
    private Date applyEndTime;
    private Short sorted;
    private Short nature;
    private Short applyDifficulty;
    private Short hasScholarship;
    private String description;
    private String hotMajor;
    private String tuition;
    private String accommodation;
    private String otherCost;
    private String phone;

    @Id @GeneratedValue(strategy=GenerationType.AUTO) @SearchableId    
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="school_id", nullable=false)
    public School getSchool() {
        return this.school;
    }
    
    public void setSchool(School school) {
        this.school = school;
    }
    
    @Column(name="toefl", length=16)
    @SearchableProperty
    public String getToefl() {
        return this.toefl;
    }
    
    public void setToefl(String toefl) {
        this.toefl = toefl;
    }
    
    @Column(name="gre", length=16)
    @SearchableProperty
    public String getGre() {
        return this.gre;
    }
    
    public void setGre(String gre) {
        this.gre = gre;
    }
    
    @Column(name="sat", length=16)
    @SearchableProperty
    public String getSat() {
        return this.sat;
    }
    
    public void setSat(String sat) {
        this.sat = sat;
    }
    
    @Column(name="ps", length=16)
    @SearchableProperty
    public String getPs() {
        return this.ps;
    }
    
    public void setPs(String ps) {
        this.ps = ps;
    }
    
    @Column(name="cv", length=16)
    @SearchableProperty
    public String getCv() {
        return this.cv;
    }
    
    public void setCv(String cv) {
        this.cv = cv;
    }
    
    @Column(name="rl", length=16)
    @SearchableProperty
    public String getRl() {
        return this.rl;
    }
    
    public void setRl(String rl) {
        this.rl = rl;
    }
    
    @Column(name="essay", length=16)
    @SearchableProperty
    public String getEssay() {
        return this.essay;
    }
    
    public void setEssay(String essay) {
        this.essay = essay;
    }
    
    @Column(name="apply_url", length=256)
    @SearchableProperty
    public String getApplyUrl() {
        return this.applyUrl;
    }
    
    public void setApplyUrl(String applyUrl) {
        this.applyUrl = applyUrl;
    }
    
    @Column(name="apply_cost", length=16)
    @SearchableProperty
    public String getApplyCost() {
        return this.applyCost;
    }
    
    public void setApplyCost(String applyCost) {
        this.applyCost = applyCost;
    }
    
    @Column(name="send_address", length=512)
    @SearchableProperty
    public String getSendAddress() {
        return this.sendAddress;
    }
    
    public void setSendAddress(String sendAddress) {
        this.sendAddress = sendAddress;
    }
    
    @Column(name="apply_end_time", nullable=false)
    @SearchableProperty
    public Date getApplyEndTime() {
        return this.applyEndTime;
    }
    
    public void setApplyEndTime(Date applyEndTime) {
        this.applyEndTime = applyEndTime;
    }
    
    @Column(name="sorted", nullable=false)
    @SearchableProperty
    public Short getSorted() {
        return this.sorted;
    }
    
    public void setSorted(Short sorted) {
        this.sorted = sorted;
    }
    
    @Column(name="nature", nullable=false)
    @SearchableProperty
    public Short getNature() {
        return this.nature;
    }
    
    public void setNature(Short nature) {
        this.nature = nature;
    }
    
    @Column(name="apply_difficulty", nullable=false)
    @SearchableProperty
    public Short getApplyDifficulty() {
        return this.applyDifficulty;
    }
    
    public void setApplyDifficulty(Short applyDifficulty) {
        this.applyDifficulty = applyDifficulty;
    }
    
    @Column(name="has_scholarship", nullable=false)
    @SearchableProperty
    public Short getHasScholarship() {
        return this.hasScholarship;
    }
    
    public void setHasScholarship(Short hasScholarship) {
        this.hasScholarship = hasScholarship;
    }
    
    @Column(name="description", length=1024)
    @SearchableProperty
    public String getDescription() {
        return this.description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    @Column(name="hot_major", length=64)
    @SearchableProperty
    public String getHotMajor() {
        return this.hotMajor;
    }
    
    public void setHotMajor(String hotMajor) {
        this.hotMajor = hotMajor;
    }
    
    @Column(name="tuition", length=16)
    @SearchableProperty
    public String getTuition() {
        return this.tuition;
    }
    
    public void setTuition(String tuition) {
        this.tuition = tuition;
    }
    
    @Column(name="accommodation", length=16)
    @SearchableProperty
    public String getAccommodation() {
        return this.accommodation;
    }
    
    public void setAccommodation(String accommodation) {
        this.accommodation = accommodation;
    }
    
    @Column(name="other_cost", length=16)
    @SearchableProperty
    public String getOtherCost() {
        return this.otherCost;
    }
    
    public void setOtherCost(String otherCost) {
        this.otherCost = otherCost;
    }
    
    @Column(name="phone", length=16)
    @SearchableProperty
    public String getPhone() {
        return this.phone;
    }
    
    public void setPhone(String phone) {
        this.phone = phone;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SchoolInfo pojo = (SchoolInfo) o;

        if (school != null ? !school.equals(pojo.school) : pojo.school != null) return false;
        if (toefl != null ? !toefl.equals(pojo.toefl) : pojo.toefl != null) return false;
        if (gre != null ? !gre.equals(pojo.gre) : pojo.gre != null) return false;
        if (sat != null ? !sat.equals(pojo.sat) : pojo.sat != null) return false;
        if (ps != null ? !ps.equals(pojo.ps) : pojo.ps != null) return false;
        if (cv != null ? !cv.equals(pojo.cv) : pojo.cv != null) return false;
        if (rl != null ? !rl.equals(pojo.rl) : pojo.rl != null) return false;
        if (essay != null ? !essay.equals(pojo.essay) : pojo.essay != null) return false;
        if (applyUrl != null ? !applyUrl.equals(pojo.applyUrl) : pojo.applyUrl != null) return false;
        if (applyCost != null ? !applyCost.equals(pojo.applyCost) : pojo.applyCost != null) return false;
        if (sendAddress != null ? !sendAddress.equals(pojo.sendAddress) : pojo.sendAddress != null) return false;
        if (applyEndTime != null ? !applyEndTime.equals(pojo.applyEndTime) : pojo.applyEndTime != null) return false;
        if (sorted != null ? !sorted.equals(pojo.sorted) : pojo.sorted != null) return false;
        if (nature != null ? !nature.equals(pojo.nature) : pojo.nature != null) return false;
        if (applyDifficulty != null ? !applyDifficulty.equals(pojo.applyDifficulty) : pojo.applyDifficulty != null) return false;
        if (hasScholarship != null ? !hasScholarship.equals(pojo.hasScholarship) : pojo.hasScholarship != null) return false;
        if (description != null ? !description.equals(pojo.description) : pojo.description != null) return false;
        if (hotMajor != null ? !hotMajor.equals(pojo.hotMajor) : pojo.hotMajor != null) return false;
        if (tuition != null ? !tuition.equals(pojo.tuition) : pojo.tuition != null) return false;
        if (accommodation != null ? !accommodation.equals(pojo.accommodation) : pojo.accommodation != null) return false;
        if (otherCost != null ? !otherCost.equals(pojo.otherCost) : pojo.otherCost != null) return false;
        if (phone != null ? !phone.equals(pojo.phone) : pojo.phone != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (school != null ? school.hashCode() : 0);
        result = 31 * result + (toefl != null ? toefl.hashCode() : 0);
        result = 31 * result + (gre != null ? gre.hashCode() : 0);
        result = 31 * result + (sat != null ? sat.hashCode() : 0);
        result = 31 * result + (ps != null ? ps.hashCode() : 0);
        result = 31 * result + (cv != null ? cv.hashCode() : 0);
        result = 31 * result + (rl != null ? rl.hashCode() : 0);
        result = 31 * result + (essay != null ? essay.hashCode() : 0);
        result = 31 * result + (applyUrl != null ? applyUrl.hashCode() : 0);
        result = 31 * result + (applyCost != null ? applyCost.hashCode() : 0);
        result = 31 * result + (sendAddress != null ? sendAddress.hashCode() : 0);
        result = 31 * result + (applyEndTime != null ? applyEndTime.hashCode() : 0);
        result = 31 * result + (sorted != null ? sorted.hashCode() : 0);
        result = 31 * result + (nature != null ? nature.hashCode() : 0);
        result = 31 * result + (applyDifficulty != null ? applyDifficulty.hashCode() : 0);
        result = 31 * result + (hasScholarship != null ? hasScholarship.hashCode() : 0);
        result = 31 * result + (description != null ? description.hashCode() : 0);
        result = 31 * result + (hotMajor != null ? hotMajor.hashCode() : 0);
        result = 31 * result + (tuition != null ? tuition.hashCode() : 0);
        result = 31 * result + (accommodation != null ? accommodation.hashCode() : 0);
        result = 31 * result + (otherCost != null ? otherCost.hashCode() : 0);
        result = 31 * result + (phone != null ? phone.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("id").append("='").append(getId()).append("', ");
        sb.append("school").append("='").append(getSchool()).append("', ");
        sb.append("toefl").append("='").append(getToefl()).append("', ");
        sb.append("gre").append("='").append(getGre()).append("', ");
        sb.append("sat").append("='").append(getSat()).append("', ");
        sb.append("ps").append("='").append(getPs()).append("', ");
        sb.append("cv").append("='").append(getCv()).append("', ");
        sb.append("rl").append("='").append(getRl()).append("', ");
        sb.append("essay").append("='").append(getEssay()).append("', ");
        sb.append("applyUrl").append("='").append(getApplyUrl()).append("', ");
        sb.append("applyCost").append("='").append(getApplyCost()).append("', ");
        sb.append("sendAddress").append("='").append(getSendAddress()).append("', ");
        sb.append("applyEndTime").append("='").append(getApplyEndTime()).append("', ");
        sb.append("sorted").append("='").append(getSorted()).append("', ");
        sb.append("nature").append("='").append(getNature()).append("', ");
        sb.append("applyDifficulty").append("='").append(getApplyDifficulty()).append("', ");
        sb.append("hasScholarship").append("='").append(getHasScholarship()).append("', ");
        sb.append("description").append("='").append(getDescription()).append("', ");
        sb.append("hotMajor").append("='").append(getHotMajor()).append("', ");
        sb.append("tuition").append("='").append(getTuition()).append("', ");
        sb.append("accommodation").append("='").append(getAccommodation()).append("', ");
        sb.append("otherCost").append("='").append(getOtherCost()).append("', ");
        sb.append("phone").append("='").append(getPhone()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
